import java.util.PriorityQueue;

/**
* @description: 周赛312 t1
* @author hewei
* @date 2022/9/25 14:05
* @version 1.0
*/

public class SortPeople {

    public String[] sortPeople(String[] names, int[] heights) {
        PriorityQueue<Integer> heap = new PriorityQueue<>((a, b) -> heights[b] - heights[a]);
        for (int i = 0; i < heights.length; i++) {
            heap.add(i);
        }
        String[] ans = new String[names.length];
        for (int i = 0; i < ans.length; i++) {
            ans[i] = names[heap.poll()];
        }
        return ans;
    }
}
